﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BusinessLogic;
using BaseEntities;
using DataAccess;
using System.Data;

namespace TestProject
{
    /// <summary>
    /// Summary description for CheckBalance
    /// </summary>
    [TestClass]
    public class CheckBalance
    {
        public CheckBalance()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod()]
        public void TestGetCheckBalance1()
        {
            Card card = new Card();
            card.CardNo = "1111111111111111";
            DataTable actual = BusinessLogic.AccountLogic.GetCheckBalance(card);
            DataTable expected = DataAccess.DataAccess.ExeStoredWithParamToDataTable("proGetCheckBalance", "@CardNo", card.CardNo);
            Assert.IsTrue(TableComparer.CompareDataTables(expected, actual));
        }
        [TestMethod()]
        public void TestGetCheckBalance2()
        {
            Card card = new Card();
            card.CardNo = "11111";
            DataTable actual = BusinessLogic.AccountLogic.GetCheckBalance(card);
            DataTable expected = DataAccess.DataAccess.ExeStoredWithParamToDataTable("proGetCheckBalance", "@CardNo", card.CardNo);
            Assert.IsTrue(TableComparer.CompareDataTables(expected, actual));
        }
        [TestMethod()]
        public void TestGetCheckBalance3()
        {
            Card card = new Card();
            card.CardNo = "111111111111111111";
            DataTable actual = BusinessLogic.AccountLogic.GetCheckBalance(card);
            DataTable expected = DataAccess.DataAccess.ExeStoredWithParamToDataTable("proGetCheckBalance", "@CardNo", card.CardNo);
            Assert.IsTrue(TableComparer.CompareDataTables(expected, actual));
        }
        [TestMethod()]
        public void TestGetCheckBalance4()
        {
            Card card = new Card();
            card.CardNo = "";
            DataTable actual = BusinessLogic.AccountLogic.GetCheckBalance(card);
            DataTable expected = DataAccess.DataAccess.ExeStoredWithParamToDataTable("proGetCheckBalance", "@CardNo", card.CardNo);
            Assert.IsTrue(TableComparer.CompareDataTables(expected, actual));
        }
        [TestMethod()]
        public void TestSaveCheckBalance1()
        {
            int ATMID1 = 1;
            Card card = new Card();
            card.CardNo = "1111111111111111";
            bool actual = BusinessLogic.LogLogic.SaveCheckBalance(ATMID1, card);
            bool expected = DataAccess.DataAccess.ExeNonStored("proSaveCheckBalance", "@ATMID", ATMID1, "@CardNo", card.CardNo);
            Assert.AreEqual(expected, actual);
        }
        [TestMethod()]
        public void TestSaveCheckBalance2()
        {
            int ATMID1 = 1;
            Card card = new Card();
            card.CardNo = "111111111111111111";
            bool actual = BusinessLogic.LogLogic.SaveCheckBalance(ATMID1, card);
            bool expected = DataAccess.DataAccess.ExeNonStored("proSaveCheckBalance", "@ATMID", ATMID1, "@CardNo", card.CardNo);
            Assert.AreEqual(expected, actual);
        }
    }
}
